Button Action

  • Step 1:
    
    
                  <form>
        <header>
            <button name="action_do_something" type="object" string="Do Something"/>
        </header>
        <sheet>
            <field name="name"/>
        </sheet>
    </form>
    
    
    
    from odoo import fields, models
    
    class TestAction(models.Model):
        _name = "test.action"
    
        name = fields.Char()
    
        def action_do_something(self):
            for record in self:
                record.name = "Something"
            return True